package com.hu.consumer;

import com.hu.model.User;
import com.hu.service.UserService;
import com.hu.proxy.ServiceProxyFactory;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class EasyConsumerExample {

    public static void main(String[] args) {
        log.info("1、开始注册代理！");
        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        //UserService userService = new UserServiceProxy();
        User user = new User();
        user.setName("yupi");
        // 调用
        log.info("2、获取服务信息！！");
        User newUser = userService.getUser(user);
        if (newUser != null) {
            log.info(newUser.getName());
            System.out.println(newUser.getName());
        } else {
            System.out.println("user == null");
        }
    }
}